home *** CD-ROM | disk | FTP | other *** search
Text File | 1989-11-03 | 1.6 KB | 41 lines | [TEXT/GEOL] |
- Item 6374083 3-Nov-89 09:24
-
- From: PASCOE1 Pascoe, Geoff
-
- To: MACAPP.TECH$ MacApp Technical
-
- Sub: Re Re Failure Handling
-
- Curtis and Larry
-
- Freeing objects in case of failures in initialization methods is the most
- common use of failure handlers, but there are other uses-
-
- • Freeing of any type of memory
- • Unlocking of handles
- • Closing files
- • other stuff
-
- Basically, you need to use failure handlers anytime you need something 'like'
- an atomic action. That is, do it all or don't do anything. Of course,
- sometimes you can't tell that an action will fail in the middle of an action,
- or at least it would be inconvenient to preflight everything. So, you set up a
- failure handler to undo everything that needs to be 'nullified' up to the point
- (closing files, network connections, freeing memory, etc.) where the failure
- happened.
-
- This all seems kind of complicated and requires a lot of thought (see my reply
- to your TCellSelectCommand bug). I find that in my own work I tend to put in
- all the failure handlers last. You have to get into a special kind of frame of
- mind, but once you do you can really make a lot of progress quickly.
-
- I happen to think this one of the really nice features of MacApp. If used
- properly it can make your application orders of magnitude more robust.
-
- Geoff
-
- P.S. Don't forget to test the failure handlers. The MacApp debugger has some
- facilities to invoke failure handlers to help you in this task. It's easy to
- make mistakes in this stuff.
-
-